package com.example.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.po.SysPay;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SysPayDao extends BaseMapper<SysPay> {

    @Select("select * from sys_pay where order_id =#{orderId}")
    public SysPay getSysPay(@Param("orderId") String orderId);

    @Select("select * from sys_pay where status = 1 and payed = 1 and ((retry_count = 0) or (retry_count < #{maxRetryCount} and retry_time < now())) order by id desc LIMIT 10")
    public List<SysPay> getSysPayList(@Param("maxRetryCount") int maxRetryCount);
}
